package com.softjourn.punchcard.lib;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;

public class PropertiesUtil {
	
	Context context;
	
	public PropertiesUtil (Context context) {
		this.context = context;
	}
	
	public String getProperty(String property)
	{
	
		Resources resources = context.getResources();
		AssetManager assetManager = resources.getAssets();
	
		// Read from the /assets directory
		try {
		    InputStream inputStream = assetManager.open("punchcard.properties");
		    Properties properties = new Properties();
		    properties.load(inputStream);
		    
		    return properties.getProperty(property);
		} catch (IOException e) {
		    System.err.println("Failed to open microlog property file");
		    e.printStackTrace();
		}
		return null;
	}

}
